<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../js/jquery-3.1.0.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/diyUpload/css/webuploaderBrand.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/diyUpload/css/diyUploadBrand.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/diyUpload/js/webuploader.html5only.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/diyUpload/js/diyUpload.js"></script>
<head>
<title></title>
<style>

p, td, div {
	font: 12px Microsoft Yahei, "sans-serif", "Arial", "Verdana";
}
.main-div {
	background: #f3f3f3 url("../images/th_bg.gif") repeat-x;
	border: 1px solid #ddd;
	margin-bottom: 10px;
	padding: 2px;
}
body {
	margin: 0px;
	padding: 0px;
	color: #192e32;
	font: 12px Microsoft Yahei, "sans-serif", "Arial", "Verdana";
}
form {
	margin: 0px;
	padding: 0px;
}
.main-div table {
	background: #FFF;
	border-top: 10px solid #FFF;
	border-bottom: 10px solid #FFF;
	width: 100%;
}
input, textarea, select, button {
	font: 12px Microsoft Yahei, "courier new";
}
input, textarea {
	outline: 0;
}
input.button {
	padding: 5px 15px 5px;
	margin: 2px 2px;
	border: none;
	background: #ff3f3f;
	color: #fff;
	cursor: pointer;
	border-radius: 3px;
}
td.label {
	text-align: right;
	vertical-align: top;
	font-weight: bold;
	padding: 5px 1em;
	width: 30%;
	line-height: 30px;
}
.notice-span {
	color: #666;
}
a:link {
	color: #335b64;
	text-decoration: none;
}
span.require-field {
	margin-left: 1em;
	font: 12px verdana;
	color: #ff0000;
}
	#box{ margin:10px auto; width:150px; min-height:25px; background:#f4f4f4}
</style>
</head>
<body>

<div class="main-div">
<table width="100%" cellspacing="1" cellpadding="3">
  <tbody><tr>
    <td class="label">品牌名称</td>
    <td>
    <input type="hidden" name="id" id="brandid" value="">
    <input name="name" type="text" maxlength="60" id="brandname" value=""><span class="require-field">*</span></td>
  </tr>
  <tr>
    <td class="label">
        <img width="16" height="16" alt="点击此处查看提示信息" src="../img/what.png" border="0">品牌LOGO</td>
    <td>
    <div id="demo">
	<div id="as" >
	</div>
</div>
 <br>
    </td>
  </tr>
  <tr>
    <td class="label">品牌描述</td>
    <td><textarea name="desc" rows="4" cols="60"  id="desc" ></textarea></td>
  </tr>
  <tr>
    <td class="label">排序</td>
    <td><input name="sort" type="text" size="15" maxlength="40" id="sort" value=""></td>
  </tr>
  <tr>
    <td class="label">是否显示</td>
    <td><input name="what" type="radio" checked="checked" id="show" class="show" value=""> 是        <input name="is_show" class="show" type="radio"  value=""> 否        (当品牌下还没有商品的时候，首页及分类页的品牌区将不会显示该品牌。)
    </td>
  </tr>
  <tr>
    <td align="center" colspan="2"><br>
      <input class="button" type="button" id="Dotrue" value=" 确定 ">
      <input class="button" type="reset" value=" 重置 ">
      <input name="act" type="hidden" value="updata">
    </td>
  </tr>
</tbody></table>
</div>

	<script type="text/javascript">
		$(function() {
			$('#test').diyUpload({
				url:'../BrandServlet?method=updateBrandOne',
				success:function( data ) {
					console.info( data );
				},
				error:function( err ) {
					console.info( err );	
				}
			});

			$('#as').diyUpload({
				url:'../BrandServlet?method=updateBrandOne',
				success:function( data ) {
					console.info( data );
				},
				error:function( err ) {
					console.info( err );	
				},
				buttonText : '选择文件',
				chunked:true,
				chunkSize:512 * 1024,
				fileNumLimit:50,
				fileSizeLimit:500000 * 1024,
				fileSingleSizeLimit:50000 * 1024,
				accept: {}
			});
			$("#Dotrue").click(function(){
				var brandid=$("#brandid").val();
				var name=$("#brandname").val();
				var desc=$("#desc").val();
				var sort=$("#sort").val();
				var show=$("#show").val();
				alert("品牌id"+brandid);
				alert("品牌名称"+name);
				alert("品牌描述"+desc);
				alert("品牌排序"+sort+"品牌状态"+show);
				$.getJSON("../BrandServlet?method=addBrands",
						{
					id:brandid,
					name:name,
					desc:desc,
					what:show,
					sort:sort
						},function(data){
							$("#rightdiv").load("../yf/brandlist.jsp");
				})
		
		})
		})
	</script>
</body>
</html>
